import { $cToptips } from '../../../utils/index'
Page({
  showToptips1() {
    $cToptips().show({
      icon: 'cancel',
      hidden: false,
      text: 'Toptips Title',
      duration: 3000,
      success() { },
    })
  },
  showToptips2() {
    $cToptips().success({
      hidden: false,
      text: 'Toptips Title',
      duration: 3000,
      success() { },
    })
  },
  showToptips3() {
    $cToptips().info({
      hidden: false,
      text: 'Toptips Title',
      duration: 3000,
      success() { },
    })
  },
  showToptips4() {
    $cToptips().warn({
      hidden: false,
      text: 'Toptips Title',
      duration: 3000,
      success() { },
    })
  },
  showToptips5() {
    $cToptips().error({
      hidden: false,
      text: 'Toptips Title',
      duration: 3000,
      success() { },
    })
  },
  showToptips6() {
    if (this.timeout) clearTimeout(this.timeout)

    const hide = $cToptips().show({
      icon: 'cancel',
      hidden: false,
      text: 'Toptips Title',
      duration: 3000,
    })

    this.timeout = setTimeout(hide, 1000)
  },
  showToptips7() {
    const hide = $cToptips().show({
      icon: 'cancel',
      hidden: false,
      text: 'Toptips Title',
      duration: 3000,
    })

    // hide.promise.then(() => console.log('success'))
    hide.then(() => console.log('success'))
  },
})